﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WindowsFormsApp1_Calculator
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {
            string ope;
            int a, b, c;
            a = Convert.ToInt32(textBox1.Text);
            b = Convert.ToInt32(textBox2.Text);
            ope = textBox4.Text;
            if (ope == "+") c = a + b;      
            else
            {
                if (ope == "-") c = a - b;
                else
                {
                    if (ope == "*") c = a * b;
                    else
                    {
                        if(ope == "/" && b != 0)  c = a / b;
                        else
                        {
                            textBox3.Text = "Illegal";
                            return;
                        }
                    }
                }
            }
            textBox3.Text = Convert.ToString(c);
        }
    }
}
